﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Rocket.Windows.Framework
{
    public enum ButtonPanelViewModes
    {
        View,
        Edit,
        Filter
    }

    public partial class AdminController : UserControl
    {
        public event EventHandler AddUpdateClick;
        public event EventHandler DeleteClick;
        public event EventHandler CreateNewClick;
        public event EventHandler RefreshClick;
        public event EventHandler FilterClick;
        public event EventHandler LoadAllClick;
        public AdminController()
        {
            InitializeComponent();
        }
        private ButtonPanelViewModes _viewModes;
        public ButtonPanelViewModes ViewModes
        {
            get { return _viewModes; }
            set 
            { 
                _viewModes = value;
                switch (_viewModes)
                {
                    case ButtonPanelViewModes.View:
                        {
                            this.tableLayoutPanelMain.ColumnStyles[0].Width = 0;
                            this.tableLayoutPanelMain.ColumnStyles[1].Width = 0; 
                            this.tableLayoutPanelMain.ColumnStyles[2].Width = 0;
                            this.tableLayoutPanelMain.ColumnStyles[3].Width = 0; 
                            this.tableLayoutPanelMain.ColumnStyles[4].Width = 0;
                            this.tableLayoutPanelMain.ColumnStyles[5].Width = 0;
                        }break;
                    case ButtonPanelViewModes.Filter:
                        {
                            this.tableLayoutPanelMain.ColumnStyles[0].Width = 0;
                            this.tableLayoutPanelMain.ColumnStyles[1].Width = 0;
                            this.tableLayoutPanelMain.ColumnStyles[2].Width = 0;
                        } break;
                    case ButtonPanelViewModes.Edit:
                        {
                            this.tableLayoutPanelMain.ColumnStyles[3].Width = 0;
                            this.tableLayoutPanelMain.ColumnStyles[4].Width = 0;
                            this.tableLayoutPanelMain.ColumnStyles[5].Width = 0;
                        } break;
                }
            }
        }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (DeleteClick != null)
                DeleteClick(sender, e);
        }

        private void buttonAddUpdate_Click(object sender, EventArgs e)
        {
            if (AddUpdateClick != null)
                AddUpdateClick(sender, e);
        }

        private void buttonCreateNew_Click(object sender, EventArgs e)
        {
            if (CreateNewClick != null)
                CreateNewClick(sender, e);
        }

        private void buttonLoadAll_Click(object sender, EventArgs e)
        {
            if (LoadAllClick != null)
                LoadAllClick(sender, e);
        }

        private void buttonFilter_Click(object sender, EventArgs e)
        {
            if (FilterClick != null)
                FilterClick(sender, e);
        }

        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            if (RefreshClick != null)
                RefreshClick(sender, e);
        }
    }
}
